package com.ccp.dev.workflow.model.bpm;

import com.ccp.dev.core.basic.model.BaseModel;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * ClassDescribe:
 * 会签任务投票规则 Model对象
 * @author :wangcheng
 * Date: 2019-09-04
 */
@XmlRootElement(name = "bpmNodeSign")
@XmlAccessorType(XmlAccessType.NONE)
public class BpmNodeSign extends BaseModel<BpmNodeSign> implements Cloneable
{
    /**
     * 表名称
     */
    public static final String TABLE_NAME="BPM_NODE_SIGN";
    /**
     * 投票类型 百分比数
     */
    public static final Short VOTE_TYPE_PERCENT=1;
    /**
     * 投票类型 绝对票数
     */
    public static final Short VOTE_TYPE_ABSOLUTE=2;

    /**
     * 后续处理模式--直接处理=1
     */
    public static final Short FLOW_MODE_DIRECT=1;
    /**
     * 后续处理模式--等待所有人投票=2
     */
    public static final Short FLOW_MODE_WAITALL=2;

    /**
     * 会签决策类型--通过=1
     */
    public static final Short DECIDE_TYPE_PASS=1;
    /**
     * 会签决策类型--反对=2
     */
    public static final Short DECIDE_TYPE_REFUSE=2;

    /**
     * signId
     */
    @XmlAttribute
    protected String signId;

    /**
     * 流程节点ID
     */
    @XmlAttribute
    protected String nodeId=" ";
    /**
     * 票数
     */
    @XmlAttribute
    protected Long voteAmount=0L;
    /**
     * 决策方式
     */
    @XmlAttribute
    protected Short decideType=0;
    /**
     * 1=百分比
     */
    @XmlAttribute
    protected Short voteType=0;
    /**
     * Act流程定义ID
     */
    @XmlAttribute
    protected String procDefId=" ";

    /**
     * 后续处理模式
     */
    @XmlAttribute
    protected Short flowMode;

    public Short getFlowMode() {
        return flowMode;
    }

    public void setFlowMode(Short flowMode) {
        this.flowMode = flowMode;
    }

    public void setSignId(String signId)
    {
        this.signId = signId;
    }
    /**
     * 返回 signId
     * @return
     */
    public String getSignId()
    {
        return signId;
    }



    public void setNodeId(String nodeId)
    {
        this.nodeId = nodeId;
    }
    /**
     * 返回 流程节点ID
     * @return
     */
    public String getNodeId()
    {
        return nodeId;
    }

    public void setVoteAmount(Long voteAmount)
    {
        this.voteAmount = voteAmount;
    }
    /**
     * 返回 票数
     * @return
     */
    public Long getVoteAmount()
    {
        return voteAmount;
    }

    public void setDecideType(Short decideType)
    {
        this.decideType = decideType;
    }
    /**
     * 返回 决策方式
     * @return
     */
    public Short getDecideType()
    {
        return decideType;
    }

    public void setVoteType(Short voteType)
    {
        this.voteType = voteType;
    }
    /**
     * 返回 1=百分比
     * @return
     */
    public Short getVoteType()
    {
        return voteType;
    }

    public String getProcDefId() {
        return procDefId;
    }

    public void setProcDefId(String procDefId) {
        this.procDefId = procDefId;
    }

    /**
     * @see java.lang.Object#equals(Object)
     */
    @Override
    public boolean equals(Object object)
    {
        if (!(object instanceof BpmNodeSign))
        {
            return false;
        }
        BpmNodeSign rhs = (BpmNodeSign) object;
        return new EqualsBuilder()
                .append(this.signId, rhs.signId)

                .append(this.nodeId, rhs.nodeId)
                .append(this.voteAmount, rhs.voteAmount)
                .append(this.decideType, rhs.decideType)
                .append(this.voteType, rhs.voteType)
                .append(this.procDefId, rhs.procDefId)
                .isEquals();
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode()
    {
        return new HashCodeBuilder(-82280557, -700257973)
                .append(this.signId)

                .append(this.nodeId)
                .append(this.voteAmount)
                .append(this.decideType)
                .append(this.voteType)
                .append(this.procDefId)
                .toHashCode();
    }

    /**
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString()
    {
        return new ToStringBuilder(this)
                .append("signId", this.signId)

                .append("nodeId", this.nodeId)
                .append("voteAmount", this.voteAmount)
                .append("decideType", this.decideType)
                .append("voteType", this.voteType)
                .append("actDeployId", this.procDefId)
                .toString();
    }


    @Override
    public Object clone()
    {
        BpmNodeSign obj=null;
        try{
            obj=(BpmNodeSign)super.clone();
        }catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return obj;
    }

}
